package com.fas.core.plugin.shiro.kit;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import com.fas.hehe.system.model.LoginUser;

/**
 * 
 * 登录信息工具类
 *
 * @Copyright: Copyright (c) 2016 FAS
 * @anthor yixiaoping<thinker1013@163.com>
 * @since 2016年1月24日 下午10:14:36
 * @version V1.0
 */
public class FasShiroKit {

	private FasShiroKit() {
	}

	public static Subject getSubject() {
		return SecurityUtils.getSubject();
	}

	public static String principal() {
		if (getSubject() != null) {
			LoginUser principal = (LoginUser) getSubject().getPrincipal();
			return principal.getPramaryPrincipal();
		}
		return "";
	}

	public static LoginUser loginUser() {
		if (getSubject() != null) {
			LoginUser principal = (LoginUser) getSubject().getPrincipal();
			return principal;
		}
		return null;
	}

	public static void main(String[] args) {
		org.apache.shiro.codec.Base64.decode("4AvVhmFLUs0KTA3Kprsdag==");
	}
}
